{include file="common/header"}
<div id="app" v-cloak>
    <el-curd 
        :field="field" 
        :table-sort="{prop: 'integral', order: 'asc'}"
        :search-date="false" 
        search-keyword="请输入名称搜索"
        save-title="添加用户等级"
        form-label-width="160px">
    </el-curd>
</div>
<script>
    new Vue({
        el: '#app',
        data() {
            return {
                field: [
                    {
                        label: '编号',
                        prop: 'id',
                        table: false,
                    },
                    {
                        label: '等级图标', 
                        prop: 'icon', 
                        table: {
                            sort: true,
                            is: 'el-image',
                        },
                        form:{
                            is: 'el-file-upload',
                            type: '.png,.jpg,.jpeg',
                        }
                    },
                    {
                        label: '等级背景图', 
                        prop: 'background', 
                        table: {
                            sort: true,
                            is: 'el-image',
                        },
                        form:{
                            is: 'el-file-upload',
                            type: '.png,.jpg,.jpeg',
                        }
                    },
                    {
                        label: '等级名称', 
                        prop: 'title', 
                        table: {sort: true},
                        form:{
                            rules: [
                                {required: true,message: '名称不能为空'},
                            ]
                        }
                    },
                    {
                        label: '解锁需经验值达到', 
                        prop: 'integral', 
                        table: {sort: true},
                        form:{
                            is: 'el-input-number',
                            default: 0,
                            rules: [
                                {required: true,message: '解锁需经验值不能为空'},
                            ],
                        }
                    },
                    {
                        label: '享受折扣', 
                        prop: 'discount', 
                        table: {sort: true},
                        form:{
                            is: 'el-input-number',
                            default: 99,
                            rules: [
                                {required: true,message: '折扣不能为空'},
                            ],
                        }
                    },
                    {
                        label: '等级说明', 
                        prop: 'describe', 
                        table: {sort: true},
                        form: {
                            type: 'textarea',
                        }
                    },
                    {
                        prop: 'status', 
                        label: '是否显示',  
                        table: {
                            is: 'el-switch', 
                            sort: true
                        },
                        form: {
                            is: 'el-switch', 
                            default: 1,
                            rules: [
                                {required: true,message: '状态不能为空'},
                            ]
                        }
                    },
                ]
            }
        },
    })
</script>
{include file="common/footer"}